# # list=['1234','1235','1']
# #
# # a=int(list[2])%10
# # b=int(int(list[2])/10%10)
# # print(a,b)
# # import matplotlib.pyplot as plt
# # plt.plot([1,2,3,4], [1,4,9,16], 'ro')#ro是显示节点，默认是红色
# # plt.axis([0, 6, 0, 20])
# # plt.show()
# import matplotlib.pyplot as plt
# import math,random
# ax=plt.figure(figsize=(10,4),dpi=100).add_subplot()
# def drawPlot(ax):
#     xs=[i/100 for i in range(1500)]
#     ys = [10*math.sin(x) for x in xs]
#     ax.plot(xs,ys,"red",lable="asdfa")
#     ys = list(range(-18,18))
#     random.shuffle(ys)
#     ax.scatter(range(16),ys[:16],c="blue")
#     ax.plot(range(16),ys[:16],"blue",lable="asdfad")
#     ax.legend()
#     ax.set_xticks(range(16))
#     ax.set_xticklabels(range(16))
#     drawPlot(ax)
#     plt.show(ax)
#
#
#
# import random
# # def int_random(a, b, n) :
# #     # 定义一个空列表存储随机数
# #     a_list = []
# #     while len(a_list) < n :
# #         d_int = random.randint(a, b)
# #         if(d_int not in a_list) :
# #             a_list.append(d_int)
# #         else :
# #             pass
# #     # 将生成的随机数列表转换成元组并返回
# #     return list(a_list)
# # list= int_random(10,20 , 10)
# # print(list)
# a_list = []
# b_list = []
# while len(a_list) < 100:
#     d_int = random.uniform(0, 30)
#     if (d_int not in a_list):
#         a_list.append(d_int)
#     else:
#         pass
#     for i in a_list:
#         if i < 1:
#             i = i * 10
#         elif 10 <= i <= 30:
#             i =int(i/10)
#         else:
#             b_list.append(i)

# number = 3.31414
# num = str(number)
# print(num)
# # print(f'List of Words ={num.split()}')
# print(num[0])
# a=num[0]
# print("最高位：%s，位数：%s" %(num[0],len(num)))
# import  math
# a=math.e**1.3
# print(a)
# numbers = [float(n) for n in range(1, 10)]
# print(numbers)



# from collections import Counter
# def Relative_probability(numbers):
#     numbers_sorted=sorted(numbers)
#     res = Counter(numbers_sorted)
#     print(res)
# numbers=[1,2,3,4,5,1,2,3,4,5.6,4,2,]
# Relative_probability(numbers)


# List =[1,2,2,3,3,3,4,4,4,4,5,5,5,5,5]
# count=[]
# a=set(List)
# for i in a:
#     count.append(List.count(i))
# print(count)


# def Relative_probability(numbers):
#     a_list=[]
#     b_list=[]
#     numbers_sorted=sorted(numbers)
#     sum=len(numbers)
#     a = set(numbers_sorted)
#     for i in a:
#         a_list.append(numbers_sorted.count(i))
# #     for i in a_list:
# #         b_list.append(i/sum)
# #     return b_list
# # numbers=[1,2,3,4]
# # print(Relative_probability(numbers))
#
# import pandas as pd
# def loadDatadet(infile):
#     f=open(infile,'r')
#     sourceInLine=f.readlines()
#     dataset_m=[]
#     dataset=[]
#     for line in sourceInLine:
#         temp1=line.strip('\n')
#         temp2=temp1.split(',')
#         dataset_m.append(temp2)
#     for content in dataset_m:
#         content=list(map(float,content))
#         dataset.append(content)
#     return dataset
# def write_csv(datalist):
#     # test=pd.DataFrame(columns=name,index=name2,data=list)
#     test=pd.DataFrame(data=datalist)
#     test.to_csv('C:\Users\Lenovo\Desktop\homework6\jia.csv', encoding='gbk')
#     return test
# infile='C:\Users\Lenovo\Desktop\homework6\ha.txt'
# infile=loadDatadet(infile)
# print('dataset=',infile)
# write_csv(infile)



import csv
import pandas as pd
import io
import sys
import urllib.request
# with open('files.csv', 'w+', newline='',encoding='utf-8') as csvfile:
#     spamwriter = csv.writer(csvfile, dialect='excel')
#     with open('literature-population.txt', 'r', encoding='utf-8') as filein:
#         for line in filein:
#             line_list = line.strip('\n').split('\t')
#             spamwriter.writerow(line_list)
#     csvfile= pd.read_csv('files.csv', header=None, names=['a', 'b'])
#     csvfile.to_csv('tf.csv', index=False)

# import matplotlib.pyplot as plt
# import math
# def Benford_distribution_1():
#     ax=plt.figure(figsize=(8, 6))  # 创建绘图对象
#     numbers = [float(n) for n in range(1, 10)]
#     benford_1 = [math.log10(1 + 1 / d) for d in range(1, 10)]
#     plt.plot(numbers, benford_1,"red", label="Benford's Law",linewidth=2)
#     # plt.plot(numbers, benford_2,"green" ,label="Generated Benford's Law", linewidth=2)
#     # plt.plot(numbers, benford_3, "blue",label="Generated Benford's Law (pi)", linewidth=2)
#     # plt.bar(x=numbers,height=list,label="US (all)",width=0.5)
#     plt.xlabel("First digit")
#     plt.ylabel("Frequency")
#     plt.savefig('scale-invariandafsce.png.')
#     plt.legend()
# #     plt.show()
# #     return ax
# #
# # def asdfa():
# #     ax=Benford_distribution_1()
# #     benford_2=[math.log10(1 + 1 / d) for d in range(2, 10)]
# #     numbers = [float(n) for n in range(1, 10)]
# #     plt.plot(numbers, benford_2, label="Generated Benford's Law", linewidth=2)
# #     plt.legend()
# #     plt.show()
# #     return ax
# # asdfa()
#
#
import random
list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
a=[]
i = 0
#设置种子使得每次抽样结果相同
# random.seed(10)
while i<3:
    slice=random.sample(list, 5)  #从list中随机获取5个元素，作为一个片断返回
    a.append(slice)
    print(a)
    print(list) #原有序列并没有改变。
    i=i+1
# for i in range(0,10):
#     print(i)